package com.my.user.web;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.my.user.entity.User;
import com.my.user.service.UserService;
import com.my.user.service.UserServiceImpl;


@WebServlet("/UserInfoSelectAction")
public class UserInfoSelectAction extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    
   

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String id_str=request.getParameter("id");
		Integer id=Integer.parseInt(id_str);
		
		UserService us=new UserServiceImpl();
		User user=us.selectOneById(id);
		
		request.setAttribute("user", user);
		request.getRequestDispatcher("userinfo.jsp").forward(request,response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
